package actions;

import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import data.StudentData;

public class VerificationAction extends Action {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
	{
		StudentData studentData = (StudentData) request.getSession().getAttribute("studentData");
		
		if(request.getParameter("degreeSpecialization") != null)
		{
			String mangledSpec = request.getParameter("degreeSpecialization");
			String[] tokens = new String[10];
			tokens = mangledSpec.split("#");
			studentData.setSpecialization(tokens[0]);
			studentData.setSpecializationID(""+tokens[1]);
		}
				
		Vector<String> formData = studentData.getFormData();
		
		request.getSession().setAttribute("formData", formData);
		request.getSession().setAttribute("studentData", studentData);
		
		return mapping.findForward("success");
	}

}
